home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / page773.pag < prev    next >
Portable Network Graphic  |  2008-10-02  |  88KB  |  817x1045  |  8-bit (256 colors)
Labels: book | chat room | crt screen | hakham | monitor | plant | sky
OCR: COMPUTER PROGRAMMING 705 How do Icode a subclass? Java uses the extends command to link subclass superclass The statement C ass Rect ang Za extends izza means "create class called RectanglePizza that's derived from the superclass called Pizza. Figure 1234 contains the Java code that creates attributes for the RectangleP izza class. FIGURE 12-34 Using the extends command, class Rect tanglePizza extends Pizza the RectanglePizza class inher- its the pizzaShape and double pizzaI Length, pizzaPrice attributes from the double pizzawi idth Pizza superclass. The pizzaL .ength and pizzaWidth attributes are unique to the RectanglePizza class METHODS AND MESSAGES How does an 00 program use objects? An 00 program can use objects variety ways basic way use objects manipulate them with methods. method s ...